package com.yang.beanfactorypostprocessor;

import com.yang.beanfactorypostprocessor.bean.X;
import com.yang.beanfactorypostprocessor.bean.Y;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @Description: 后置处理器测试类
 * @author: Yang Qiang
 * @create: 2021-10-23 18:58
 */
@Slf4j
public class PostProcessorTest {
	public static void main(String[] args) {
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
		applicationContext.register(X.class, Y.class, MyBeanFactoryPostProcessor.class);
		applicationContext.refresh();

		// 容器初始化后, 我们X类是注入了Y的, 但是这里的时候X类里面的Y属性还是null, 为什么?
		applicationContext.getBean(X.class).print();


		log.debug("X = [{}]", applicationContext.getBean("x"));
		log.debug("Y = [{}]", applicationContext.getBean("y"));
	}
}
